from rest_framework.authentication import BaseAuthentication
from rest_framework.exceptions import AuthenticationFailed
class MYAuthentication(BaseAuthentication):
    def authenticate(self, request):
        token = request.query_params.get("token")
        if token == '123':
            return  '123',token
        raise AuthenticationFailed({'code':200,'error':'认证失败'})
